﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using ByteSite.Common;

namespace ByteSite.BLL
{
    /// <summary>
    ///物流快递
    /// </summary>
    public partial class form_data_file_list
    {
        private readonly Entitys.sysconfig sysConfig = new BLL.sysconfig().loadConfig();//获得系统配置信息
        private readonly DAL.Data data;

        public form_data_file_list()
        {
            data = new DAL.Data();
        }

        #region 基本方法================================
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return data.Exists<Entitys.dt_form_data_file_list>(id);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Entitys.dt_form_data_file_list model)
        {
            return data.Insert<Entitys.dt_form_data_file_list>(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Entitys.dt_form_data_file_list model)
        {
            return data.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            return data.Delete<Entitys.dt_form_data_file_list>(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entitys.dt_form_data_file_list GetModel(int id)
        {
            return data.Get<Entitys.dt_form_data_file_list>(id);
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public List<Entitys.dt_form_data_file_list> GetList(int top, string strWhere, string filedOrder)
        {
            return data.List<Entitys.dt_form_data_file_list>(top, strWhere, filedOrder);
        }

        public List<Entitys.dt_form_data_file_list> GetList(Expression<Func<Entitys.dt_form_data_file_list, bool>> whereExpression, Expression<Func<Entitys.dt_form_data_file_list, object>> orderExpression)
        {
            return data.List<Entitys.dt_form_data_file_list>(whereExpression, orderExpression);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public List<Entitys.dt_form_data_file_list> GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return data.List<Entitys.dt_form_data_file_list>(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }
        #endregion

        #region 扩展方法================================
        /// <summary>
        /// 返回标题名称
        /// </summary>
        public string GetTitle(int id)
        {
            Entitys.dt_form_data_file_list model = data.Get<Entitys.dt_form_data_file_list>(id);
            if (model == null)
                return "";
            else
                return model.title;
        }

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public bool UpdateField(Expression<Func<Entitys.dt_form_data_file_list, Entitys.dt_form_data_file_list>> expression, Expression<Func<Entitys.dt_form_data_file_list, bool>> whereExpression)
        {
            return data.UpdateColumns<Entitys.dt_form_data_file_list>(expression, whereExpression);
        }
        #endregion
    }
}